package com.betterjr.common.codec;

import java.io.IOException;
import java.lang.reflect.Type;

public interface BtObjectInput {

    /**
     * Read boolean.
     * 
     * @return boolean.
     * @throws IOException.
     */
    boolean readBool() throws IOException;

    /**
     * Read byte.
     * 
     * @return byte value.
     * @throws IOException.
     */
    byte readByte() throws IOException;

    /**
     * Read short integer.
     * 
     * @return short.
     * @throws IOException.
     */
    short readShort() throws IOException;

    /**
     * Read integer.
     * 
     * @return integer.
     * @throws IOException.
     */
    int readInt() throws IOException;

    /**
     * Read long.
     * 
     * @return long.
     * @throws IOException.
     */
    long readLong() throws IOException;

    /**
     * Read float.
     * 
     * @return float.
     * @throws IOException.
     */
    float readFloat() throws IOException;

    /**
     * Read double.
     * 
     * @return double.
     * @throws IOException.
     */
    double readDouble() throws IOException;

    /**
     * Read UTF-8 string.
     * 
     * @return string.
     * @throws IOException.
     */
    String readUTF() throws IOException;

    /**
     * Read byte array.
     * 
     * @return byte array.
     * @throws IOException.
     */
    byte[] readBytes() throws IOException;

    /**
     * read object.
     * 
     * @return object.
     */
    Object readObject() throws IOException, ClassNotFoundException;

    /**
     * read object.
     * 
     * @param cls
     *            object type.
     * @return object.
     */
    <T> T readObject(Class<T> cls) throws IOException, ClassNotFoundException;

    /**
     * read object.
     * 
     * @param cls
     *            object type.
     * @return object.
     */
    <T> T readObject(Class<T> cls, Type type) throws IOException, ClassNotFoundException;
}
